Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add more activity types #87

Merged
merged 5 commits into from
Sep 21, 2023
Merged

Add more activity types #87

merged 5 commits into from
Sep 21, 2023

Conversation

Olen
Copy link
Contributor

@Olen Olen commented Sep 20, 2023

This adds support for manual lock/unlock and unlock using rfid-tags:

Example activities:

Manual lock

<LockOperationActivity action=manual_lock activity_type=ActivityType.LOCK_OPERATION activity_start_time=2023-09-20 22:28:17 device_name=None operated_by=Manual Lock operated_remote=False operated_keypad=False operated_tag=False operated_manual=True operated_autorelock=False operator_image_url=https://d3osa7xy9vsc0q.cloudfront.net/app/ActivityFeedIcons/[email protected] operator_thumbnail_url=https://d3osa7xy9vsc0q.cloudfront.net/app/ActivityFeedIcons/[email protected]>

Notice operated_manual=True

Manual unlock

<LockOperationActivity action=manual_unlock activity_type=ActivityType.LOCK_OPERATION activity_start_time=2023-09-20 22:27:55 device_name=None operated_by=Manual Unlock operated_remote=False operated_keypad=False operated_tag=False operated_manual=True operated_autorelock=False operator_image_url=https://d3osa7xy9vsc0q.cloudfront.net/app/ActivityFeedIcons/[email protected] operator_thumbnail_url=https://d3osa7xy9vsc0q.cloudfront.net/app/ActivityFeedIcons/[email protected]>

Notice operated_manual=True

Tag unlock

<LockOperationActivity action=rf_unlock activity_type=ActivityType.LOCK_OPERATION activity_start_time=2023-09-20 22:28:09 device_name=None operated_by=My Name operated_remote=False operated_keypad=False operated_tag=True operated_manual=False operated_autorelock=False operator_image_url=https://d3osa7xy9vsc0q.cloudfront.net/app/ActivityFeedIcons/[email protected] operator_thumbnail_url=https://d3osa7xy9vsc0q.cloudfront.net/app/ActivityFeedIcons/[email protected]>

Notice operated_tag=True

@codecov
Copy link

codecov bot commented Sep 20, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: +0.05% 🎉

Comparison is base (4ea45b2) 95.56% compared to head (299d40c) 95.62%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master      #87      +/-   ##
==========================================
+ Coverage   95.56%   95.62%   +0.05%     
==========================================
  Files          29       29              
  Lines        3316     3357      +41     
==========================================
+ Hits         3169     3210      +41     
  Misses        147      147              
Flag Coverage Δ
unittests 95.62% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Changed Coverage Δ
tests/test_activity.py 100.00% <100.00%> (ø)
yalexs/activity.py 96.68% <100.00%> (+0.11%) ⬆️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Olen Olen marked this pull request as draft September 20, 2023 21:05
@Olen Olen marked this pull request as ready for review September 20, 2023 21:09
Comment on lines +446 to +454
@cached_property
def operated_manual(self):
"""Operation done manually using the knob."""
return self._info.get("manual", self.action in MANUAL_ACTIONS)

@cached_property
def operated_tag(self):
"""Operation used rfid tag."""
return self._info.get("tag", self.action in TAG_ACTIONS)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this is only hitting coverage from the repr, we should have an explicit test for both of these to make sure its true when its operated by the knob/tag

@bdraco
Copy link
Owner

bdraco commented Sep 20, 2023

You should be able to augment

def test_manual_lock_activity_v4(self):
but I think we need a new one for tags

@Olen
Copy link
Contributor Author

Olen commented Sep 21, 2023

Fix #86

Did not add BT-methods as I don't use them, and they break yalexs-bt in HA when I test them.

@bdraco bdraco merged commit 983fc58 into bdraco:master Sep 21, 2023
8 checks passed
@bdraco bdraco mentioned this pull request Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants